package com.lc202406;

public class Solution520 {
    public boolean detectCapitalUse(String word) {
        int length = word.length();
        int count = 0;
        for (int i = 0; i < length; i++) {
            // 记录小写字母数量
            if (word.charAt(i) >= 'a') {
                count++;
            }
        }
        return count == 0 || count == length || (count == length - 1 && word.charAt(0) < 'a');
    }
}
